<!DOCTYPE html>
<html lang="en-US" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>判断字符串第一个和最后一个字符</title>
    <meta name="description" content="何以解忧，唯有代码。">
    <meta name="generator" content="VitePress v1.0.0-rc.36">
    <link rel="preload stylesheet" href="/assets/style.bd4HjyCz.css" as="style">
    
    <script type="module" src="/assets/app.YSrOHH15.js"></script>
    <link rel="preload" href="/assets/inter-roman-latin.bvIUbFQP.woff2" as="font" type="font/woff2" crossorigin="">
    <link rel="modulepreload" href="/assets/chunks/framework.ohTt0AXx.js">
    <link rel="modulepreload" href="/assets/chunks/theme.-enDg7yv.js">
    <link rel="modulepreload" href="/assets/chunks/c4Diagram-817c8e44.335ZCPU_.js">
    <link rel="modulepreload" href="/assets/chunks/flowDiagram-61eb444c.-3WyHRY3.js">
    <link rel="modulepreload" href="/assets/chunks/flowDiagram-v2-2f8f667a.n0HDaB0Z.js">
    <link rel="modulepreload" href="/assets/chunks/erDiagram-9cfc3649.NAUTFDgx.js">
    <link rel="modulepreload" href="/assets/chunks/gitGraphDiagram-6b463803.2TNZYJR9.js">
    <link rel="modulepreload" href="/assets/chunks/ganttDiagram-db6931fb.fYu1XMRw.js">
    <link rel="modulepreload" href="/assets/chunks/infoDiagram-a336098b.KNnUfRtv.js">
    <link rel="modulepreload" href="/assets/chunks/pieDiagram-a5166659.P950Pkuh.js">
    <link rel="modulepreload" href="/assets/chunks/quadrantDiagram-6c355bbc.yu4CO1HF.js">
    <link rel="modulepreload" href="/assets/chunks/xychartDiagram-f746c04c.kiw_PGtu.js">
    <link rel="modulepreload" href="/assets/chunks/requirementDiagram-4038b16c.WHpEsnS_.js">
    <link rel="modulepreload" href="/assets/chunks/sequenceDiagram-465a088a.u3IfqgAD.js">
    <link rel="modulepreload" href="/assets/chunks/classDiagram-48ab76fb.jDZHcyTA.js">
    <link rel="modulepreload" href="/assets/chunks/classDiagram-v2-8ecb0bfc.GEgZRyiC.js">
    <link rel="modulepreload" href="/assets/chunks/stateDiagram-b620d43f.VKaR8ItU.js">
    <link rel="modulepreload" href="/assets/chunks/stateDiagram-v2-2671c3d1.WFsnTzUc.js">
    <link rel="modulepreload" href="/assets/chunks/journeyDiagram-deae3313.vSCDdJ-9.js">
    <link rel="modulepreload" href="/assets/chunks/flowchart-elk-definition-e097735e.H1UVlqJc.js">
    <link rel="modulepreload" href="/assets/chunks/timeline-definition-732a2638.Ub1Bk6bP.js">
    <link rel="modulepreload" href="/assets/chunks/mindmap-definition-617cf8dd.5qMlozeM.js">
    <link rel="modulepreload" href="/assets/chunks/sankeyDiagram-6db3d513.ljQBnQsl.js">
    <link rel="modulepreload" href="/assets/chunks/virtual_mermaid-config.AhCe4kHV.js">
    <link rel="modulepreload" href="/assets/2-编程技巧_3-JavaScript_1-判断字符串第一个和最后一个字符.md.mF-carb3.lean.js">
    <link rel="shortcut icon" href="/favicon.ico">
    <script id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
    <script>LA.init({id:"KJ1QCa9hIYCxqPR4",ck:"KJ1QCa9hIYCxqPR4",autoTrack:!1,hashMode:!0});</script>
    <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
    <script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
  </head>
  <body>
    <div id="app"><div class="Layout" data-v-9c6d0652><!--[--><!--]--><!--[--><span tabindex="-1" data-v-e01f3d44></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-e01f3d44> Skip to content </a><!--]--><!----><header class="VPNav" data-v-9c6d0652 data-v-cc30c7a4><div class="VPNavBar has-sidebar" data-v-cc30c7a4 data-v-1357e23a><div class="wrapper" data-v-1357e23a><div class="container" data-v-1357e23a><div class="title" data-v-1357e23a><div class="VPNavBarTitle has-sidebar" data-v-1357e23a data-v-9c96f74a><a class="title" href="/" data-v-9c96f74a><!--[--><!--]--><!--[--><img class="VPImage logo" src="/logo.jpg" alt data-v-5475fc95><!--]--><!--[-->陈随易<!--]--><!--[--><!--]--></a></div></div><div class="content" data-v-1357e23a><div class="content-body" data-v-1357e23a><!--[--><!--]--><div class="VPNavBarSearch search" data-v-1357e23a><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-1357e23a data-v-ed78f6e9><span id="main-nav-aria-label" class="visually-hidden" data-v-ed78f6e9>Main Navigation</span><!--[--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-ed78f6e9 data-v-9d116cf3><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-9d116cf3><span class="text" data-v-9d116cf3><!----><span data-v-9d116cf3>前端世界</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-9d116cf3><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-9d116cf3><div class="VPMenu" data-v-9d116cf3 data-v-0a4b66eb><div class="items" data-v-0a4b66eb><!--[--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/1-%E5%89%8D%E7%AB%AF%E4%B8%96%E7%95%8C/1-npm%E5%8C%85%E6%8E%A8%E8%8D%90/1-%E5%9F%BA%E6%9C%AC%E7%AE%80%E4%BB%8B.html" data-v-41d677c8><!--[-->npm包推荐<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/1-%E5%89%8D%E7%AB%AF%E4%B8%96%E7%95%8C/2-%E5%89%8D%E7%AB%AF%E5%BC%80%E5%8F%91%E8%A7%84%E8%8C%83/1-%E5%9F%BA%E6%9C%AC%E7%AE%80%E4%BB%8B.html" data-v-41d677c8><!--[-->前端开发规范<!--]--></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup active" data-v-ed78f6e9 data-v-9d116cf3><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-9d116cf3><span class="text" data-v-9d116cf3><!----><span data-v-9d116cf3>编程技巧</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-9d116cf3><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-9d116cf3><div class="VPMenu" data-v-9d116cf3 data-v-0a4b66eb><div class="items" data-v-0a4b66eb><!--[--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/2-%E7%BC%96%E7%A8%8B%E6%8A%80%E5%B7%A7/1-HTML/1-%E7%A6%81%E6%AD%A2%E6%B5%8F%E8%A7%88%E5%99%A8%E5%A1%AB%E5%85%85%E8%B4%A6%E5%8F%B7%E5%AF%86%E7%A0%81.html" data-v-41d677c8><!--[-->HTML<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link active" href="/2-%E7%BC%96%E7%A8%8B%E6%8A%80%E5%B7%A7/3-JavaScript/1-%E5%88%A4%E6%96%AD%E5%AD%97%E7%AC%A6%E4%B8%B2%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%92%8C%E6%9C%80%E5%90%8E%E4%B8%80%E4%B8%AA%E5%AD%97%E7%AC%A6.html" data-v-41d677c8><!--[-->JavaScript<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/2-%E7%BC%96%E7%A8%8B%E6%8A%80%E5%B7%A7/4-Nodejs/1-patch-package.html" data-v-41d677c8><!--[-->Nodejs<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/2-%E7%BC%96%E7%A8%8B%E6%8A%80%E5%B7%A7/5-Vscode/1-%E5%A4%A7%E5%B0%8F%E5%86%99%E8%BD%AC%E6%8D%A2%E6%8F%92%E4%BB%B6.html" data-v-41d677c8><!--[-->Vscode<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/2-%E7%BC%96%E7%A8%8B%E6%8A%80%E5%B7%A7/6-%E6%95%B0%E6%8D%AE%E5%BA%93/1-%E6%B5%8F%E8%A7%88%E5%99%A8ES%E6%89%A9%E5%B1%95%E6%8F%92%E4%BB%B6.html" data-v-41d677c8><!--[-->数据库<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/2-%E7%BC%96%E7%A8%8B%E6%8A%80%E5%B7%A7/7-%E6%96%B9%E6%B3%95%E8%AE%BA/1-WEB%E5%89%8D%E7%AB%AF%E8%BF%9B%E9%98%B6%E8%B7%AF%E7%BA%BF%E5%9B%BE.html" data-v-41d677c8><!--[-->方法论<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/2-%E7%BC%96%E7%A8%8B%E6%8A%80%E5%B7%A7/8-%E5%85%B6%E4%BB%96/1-vuepress%E8%87%AA%E5%8A%A8%E7%94%9F%E6%88%90%E4%BE%A7%E8%BE%B9%E8%8F%9C%E5%8D%95.html" data-v-41d677c8><!--[-->其他<!--]--></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-ed78f6e9 data-v-9d116cf3><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-9d116cf3><span class="text" data-v-9d116cf3><!----><span data-v-9d116cf3>案例教程</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-9d116cf3><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-9d116cf3><div class="VPMenu" data-v-9d116cf3 data-v-0a4b66eb><div class="items" data-v-0a4b66eb><!--[--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/3-%E6%A1%88%E4%BE%8B%E6%95%99%E7%A8%8B/%E8%B4%AA%E5%90%83%E8%9B%87/1-%E5%9F%BA%E6%9C%AC%E7%AE%80%E4%BB%8B.html" data-v-41d677c8><!--[-->贪吃蛇<!--]--></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-ed78f6e9 data-v-9d116cf3><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-9d116cf3><span class="text" data-v-9d116cf3><!----><span data-v-9d116cf3>编程小册</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-9d116cf3><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-9d116cf3><div class="VPMenu" data-v-9d116cf3 data-v-0a4b66eb><div class="items" data-v-0a4b66eb><!--[--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/4-%E7%BC%96%E7%A8%8B%E5%B0%8F%E5%86%8C/1-WEB%E5%89%8D%E7%AB%AF/1-%E5%9F%BA%E6%9C%AC%E7%AE%80%E4%BB%8B.html" data-v-41d677c8><!--[-->WEB前端<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/4-%E7%BC%96%E7%A8%8B%E5%B0%8F%E5%86%8C/2-Node.js%E6%8C%87%E5%8D%97/1-Node.js%E5%AE%89%E8%A3%85.html" data-v-41d677c8><!--[-->Node.js指南<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/4-%E7%BC%96%E7%A8%8B%E5%B0%8F%E5%86%8C/3-%E5%BB%BA%E7%AB%99%E6%8C%87%E5%8D%97/1-%E5%9F%BA%E6%9C%AC%E7%AE%80%E4%BB%8B.html" data-v-41d677c8><!--[-->建站指南<!--]--></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-ed78f6e9 data-v-9d116cf3><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-9d116cf3><span class="text" data-v-9d116cf3><!----><span data-v-9d116cf3>软件手册</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-9d116cf3><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-9d116cf3><div class="VPMenu" data-v-9d116cf3 data-v-0a4b66eb><div class="items" data-v-0a4b66eb><!--[--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/5-%E8%BD%AF%E4%BB%B6%E6%89%8B%E5%86%8C/2-xyplorer/1-%E5%9F%BA%E6%9C%AC%E7%AE%80%E4%BB%8B.html" data-v-41d677c8><!--[-->xyplorer<!--]--></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-ed78f6e9 data-v-9d116cf3><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-9d116cf3><span class="text" data-v-9d116cf3><!----><span data-v-9d116cf3>易伴同行</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-9d116cf3><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-9d116cf3><div class="VPMenu" data-v-9d116cf3 data-v-0a4b66eb><div class="items" data-v-0a4b66eb><!--[--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/6-%E6%98%93%E4%BC%B4%E5%90%8C%E8%A1%8C/1-%E5%85%B3%E4%BA%8E%E7%A4%BE%E7%BE%A4/1-%E7%A4%BE%E7%BE%A4%E4%BB%8B%E7%BB%8D.html" data-v-41d677c8><!--[-->关于社群<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-0a4b66eb data-v-41d677c8><a class="VPLink link" href="/6-%E6%98%93%E4%BC%B4%E5%90%8C%E8%A1%8C/2-%E8%87%AA%E5%BE%8B%E8%AE%B0%E5%BD%95/1-%E9%99%88%E9%9A%8F%E6%98%93/1-2024%E5%B9%B4%E8%87%AA%E5%BE%8B.html" data-v-41d677c8><!--[-->自律记录<!--]--></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-1357e23a data-v-fe8ca031><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-fe8ca031 data-v-946da1f2 data-v-837cc2ae><span class="check" data-v-837cc2ae><span class="icon" data-v-837cc2ae><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-946da1f2><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-946da1f2><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-1357e23a data-v-8a4ae174 data-v-4430fed3><!--[--><a class="VPSocialLink no-icon" href="https://gitee.com/yicode-team/yicode" aria-label target="_blank" rel="noopener" data-v-4430fed3 data-v-87bcdc0e><?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1685703518937" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2363" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 1024C229.222 1024 0 794.778 0 512S229.222 0 512 0s512 229.222 512 512-229.222 512-512 512z m259.149-568.883h-290.74a25.293 25.293 0 0 0-25.292 25.293l-0.026 63.206c0 13.952 11.315 25.293 25.267 25.293h177.024c13.978 0 25.293 11.315 25.293 25.267v12.646a75.853 75.853 0 0 1-75.853 75.853h-240.23a25.293 25.293 0 0 1-25.267-25.293V417.203a75.853 75.853 0 0 1 75.827-75.853h353.946a25.293 25.293 0 0 0 25.267-25.292l0.077-63.207a25.293 25.293 0 0 0-25.268-25.293H417.152a189.62 189.62 0 0 0-189.62 189.645V771.15c0 13.977 11.316 25.293 25.294 25.293h372.94a170.65 170.65 0 0 0 170.65-170.65V480.384a25.293 25.293 0 0 0-25.293-25.267z" fill="#C71D23" p-id="2364"></path></svg></a><a class="VPSocialLink no-icon" href="https://github.com/chenbimo/yicode" aria-label="github" target="_blank" rel="noopener" data-v-4430fed3 data-v-87bcdc0e><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-1357e23a data-v-43827911 data-v-9d116cf3><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-9d116cf3><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="icon" data-v-9d116cf3><circle cx="12" cy="12" r="2"></circle><circle cx="19" cy="12" r="2"></circle><circle cx="5" cy="12" r="2"></circle></svg></button><div class="menu" data-v-9d116cf3><div class="VPMenu" data-v-9d116cf3 data-v-0a4b66eb><!----><!--[--><!--[--><!----><div class="group" data-v-43827911><div class="item appearance" data-v-43827911><p class="label" data-v-43827911>Appearance</p><div class="appearance-action" data-v-43827911><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-43827911 data-v-946da1f2 data-v-837cc2ae><span class="check" data-v-837cc2ae><span class="icon" data-v-837cc2ae><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-946da1f2><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-946da1f2><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div></div></div><div class="group" data-v-43827911><div class="item social-links" data-v-43827911><div class="VPSocialLinks social-links-list" data-v-43827911 data-v-4430fed3><!--[--><a class="VPSocialLink no-icon" href="https://gitee.com/yicode-team/yicode" aria-label target="_blank" rel="noopener" data-v-4430fed3 data-v-87bcdc0e><?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1685703518937" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2363" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 1024C229.222 1024 0 794.778 0 512S229.222 0 512 0s512 229.222 512 512-229.222 512-512 512z m259.149-568.883h-290.74a25.293 25.293 0 0 0-25.292 25.293l-0.026 63.206c0 13.952 11.315 25.293 25.267 25.293h177.024c13.978 0 25.293 11.315 25.293 25.267v12.646a75.853 75.853 0 0 1-75.853 75.853h-240.23a25.293 25.293 0 0 1-25.267-25.293V417.203a75.853 75.853 0 0 1 75.827-75.853h353.946a25.293 25.293 0 0 0 25.267-25.292l0.077-63.207a25.293 25.293 0 0 0-25.268-25.293H417.152a189.62 189.62 0 0 0-189.62 189.645V771.15c0 13.977 11.316 25.293 25.294 25.293h372.94a170.65 170.65 0 0 0 170.65-170.65V480.384a25.293 25.293 0 0 0-25.293-25.267z" fill="#C71D23" p-id="2364"></path></svg></a><a class="VPSocialLink no-icon" href="https://github.com/chenbimo/yicode" aria-label="github" target="_blank" rel="noopener" data-v-4430fed3 data-v-87bcdc0e><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-1357e23a data-v-5e7b729b><span class="container" data-v-5e7b729b><span class="top" data-v-5e7b729b></span><span class="middle" data-v-5e7b729b></span><span class="bottom" data-v-5e7b729b></span></span></button></div></div></div></div><div class="divider" data-v-1357e23a><div class="divider-line" data-v-1357e23a></div></div></div><!----></header><div class="VPLocalNav has-sidebar empty" data-v-9c6d0652 data-v-f7e078eb><div class="container" data-v-f7e078eb><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-f7e078eb><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="menu-icon" data-v-f7e078eb><path d="M17,11H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,11,17,11z"></path><path d="M21,7H3C2.4,7,2,6.6,2,6s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,7,21,7z"></path><path d="M21,15H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,15,21,15z"></path><path d="M17,19H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,19,17,19z"></path></svg><span class="menu-text" data-v-f7e078eb>Menu</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-f7e078eb data-v-fbd6f207><button data-v-fbd6f207>Return to top</button><!----></div></div></div><aside class="VPSidebar" data-v-9c6d0652 data-v-0265ce30><div class="curtain" data-v-0265ce30></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-0265ce30><span class="visually-hidden" id="sidebar-aria-label" data-v-0265ce30> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="group" data-v-0265ce30><section class="VPSidebarItem level-0 collapsible has-active" data-v-0265ce30 data-v-a69520da><div class="item" role="button" tabindex="0" data-v-a69520da><div class="indicator" data-v-a69520da></div><h2 class="text" data-v-a69520da>📁 JavaScript</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-a69520da><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-a69520da><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-a69520da><!--[--><div class="VPSidebarItem level-1 is-link" data-v-a69520da data-v-a69520da><div class="item" data-v-a69520da><div class="indicator" data-v-a69520da></div><a class="VPLink link link" href="/2-%E7%BC%96%E7%A8%8B%E6%8A%80%E5%B7%A7/3-JavaScript/1-%E5%88%A4%E6%96%AD%E5%AD%97%E7%AC%A6%E4%B8%B2%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%92%8C%E6%9C%80%E5%90%8E%E4%B8%80%E4%B8%AA%E5%AD%97%E7%AC%A6.html" data-v-a69520da><!--[--><p class="text" data-v-a69520da>📄 判断字符串第一个和最后一个字符</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-a69520da data-v-a69520da><div class="item" data-v-a69520da><div class="indicator" data-v-a69520da></div><a class="VPLink link link" href="/2-%E7%BC%96%E7%A8%8B%E6%8A%80%E5%B7%A7/3-JavaScript/2-%E5%89%8D%E7%AB%AF%E5%A6%82%E4%BD%95%E5%86%99%E5%87%BA%E4%BC%98%E9%9B%85%E7%9A%84%E5%BC%82%E6%AD%A5%E5%A4%84%E7%90%86%E4%BB%A3%E7%A0%81.html" data-v-a69520da><!--[--><p class="text" data-v-a69520da>📄 前端如何写出优雅的异步处理代码</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-9c6d0652 data-v-cdec0d54><div class="VPDoc has-sidebar has-aside" data-v-cdec0d54 data-v-172bb205><!--[--><!--]--><div class="container" data-v-172bb205><div class="aside" data-v-172bb205><div class="aside-curtain" data-v-172bb205></div><div class="aside-container" data-v-172bb205><div class="aside-content" data-v-172bb205><div class="VPDocAside" data-v-172bb205 data-v-c6d40b1c><!--[--><!--]--><!--[--><!--]--><div class="VPDocAsideOutline" role="navigation" data-v-c6d40b1c data-v-02d24f9d><div class="content" data-v-02d24f9d><div class="outline-marker" data-v-02d24f9d></div><div class="outline-title" role="heading" aria-level="2" data-v-02d24f9d>大纲</div><nav aria-labelledby="doc-outline-aria-label" data-v-02d24f9d><span class="visually-hidden" id="doc-outline-aria-label" data-v-02d24f9d> Table of Contents for current page </span><ul class="VPDocOutlineItem root" data-v-02d24f9d data-v-c65ef7f2><!--[--><!--]--></ul></nav></div></div><!--[--><!--]--><div class="spacer" data-v-c6d40b1c></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-172bb205><div class="content-container" data-v-172bb205><!--[--><!--]--><main class="main" data-v-172bb205><div style="position:relative;" class="vp-doc _2-%E7%BC%96%E7%A8%8B%E6%8A%80%E5%B7%A7_3-JavaScript_1-%E5%88%A4%E6%96%AD%E5%AD%97%E7%AC%A6%E4%B8%B2%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%92%8C%E6%9C%80%E5%90%8E%E4%B8%80%E4%B8%AA%E5%AD%97%E7%AC%A6" data-v-172bb205><div><h1 id="判断字符串第一个和最后一个字符" tabindex="-1">判断字符串第一个和最后一个字符 <a class="header-anchor" href="#判断字符串第一个和最后一个字符" aria-label="Permalink to &quot;判断字符串第一个和最后一个字符&quot;">​</a></h1><p>笔者最近在开源一个项目，叫做 ==yidash（易大师）== ，一个基于 lodash 扩展的业务工具函数库。</p><blockquote><p>开源地址：<a href="https://github.com/chenbimo/yidash" target="_blank" rel="noreferrer">https://github.com/chenbimo/yidash</a></p></blockquote><p>在实现其中一个 ==验证有效数字== 函数的时候，需要判断一下，字符串的最后一个数字是不是点号(.)。</p><p>觉得原来的写法不优雅，于是去查阅了 js mdn (火狐开发者平台)，看到了如下 2 个函数。</p><h3 id="string-prototype-startswith" tabindex="-1">String.prototype.startsWith() <a class="header-anchor" href="#string-prototype-startswith" aria-label="Permalink to &quot;String.prototype.startsWith()&quot;">​</a></h3><blockquote><p>startsWith() 方法用来判断当前字符串是否以另外一个给定的子字符串开头，并根据判断结果返回 true 或 false。</p></blockquote><div class="language-javascript line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">javascript</span><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#C678DD;">const</span><span style="color:#E5C07B;"> str1</span><span style="color:#56B6C2;"> =</span><span style="color:#98C379;"> &#39;Saturday night plans&#39;</span><span style="color:#ABB2BF;">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E5C07B;">console</span><span style="color:#ABB2BF;">.</span><span style="color:#61AFEF;">log</span><span style="color:#ABB2BF;">(</span><span style="color:#E5C07B;">str1</span><span style="color:#ABB2BF;">.</span><span style="color:#61AFEF;">startsWith</span><span style="color:#ABB2BF;">(</span><span style="color:#98C379;">&#39;Sat&#39;</span><span style="color:#ABB2BF;">));</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">// expected output: true</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E5C07B;">console</span><span style="color:#ABB2BF;">.</span><span style="color:#61AFEF;">log</span><span style="color:#ABB2BF;">(</span><span style="color:#E5C07B;">str1</span><span style="color:#ABB2BF;">.</span><span style="color:#61AFEF;">startsWith</span><span style="color:#ABB2BF;">(</span><span style="color:#98C379;">&#39;Sat&#39;</span><span style="color:#ABB2BF;">, </span><span style="color:#D19A66;">3</span><span style="color:#ABB2BF;">));</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">// expected output: false</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><h3 id="string-prototype-endswith" tabindex="-1">String.prototype.endsWith() <a class="header-anchor" href="#string-prototype-endswith" aria-label="Permalink to &quot;String.prototype.endsWith()&quot;">​</a></h3><blockquote><p>endsWith()方法用来判断当前字符串是否是以另外一个给定的子字符串“结尾”的，根据判断结果返回 true 或 false。</p></blockquote><div class="language-javascript line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">javascript</span><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#C678DD;">const</span><span style="color:#E5C07B;"> str1</span><span style="color:#56B6C2;"> =</span><span style="color:#98C379;"> &#39;Cats are the best!&#39;</span><span style="color:#ABB2BF;">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E5C07B;">console</span><span style="color:#ABB2BF;">.</span><span style="color:#61AFEF;">log</span><span style="color:#ABB2BF;">(</span><span style="color:#E5C07B;">str1</span><span style="color:#ABB2BF;">.</span><span style="color:#61AFEF;">endsWith</span><span style="color:#ABB2BF;">(</span><span style="color:#98C379;">&#39;best&#39;</span><span style="color:#ABB2BF;">, </span><span style="color:#D19A66;">17</span><span style="color:#ABB2BF;">));</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">// expected output: true</span></span>
<span class="line"></span>
<span class="line"><span style="color:#C678DD;">const</span><span style="color:#E5C07B;"> str2</span><span style="color:#56B6C2;"> =</span><span style="color:#98C379;"> &#39;Is this a question&#39;</span><span style="color:#ABB2BF;">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E5C07B;">console</span><span style="color:#ABB2BF;">.</span><span style="color:#61AFEF;">log</span><span style="color:#ABB2BF;">(</span><span style="color:#E5C07B;">str2</span><span style="color:#ABB2BF;">.</span><span style="color:#61AFEF;">endsWith</span><span style="color:#ABB2BF;">(</span><span style="color:#98C379;">&#39;?&#39;</span><span style="color:#ABB2BF;">));</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">// expected output: false</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div></div></div></main><footer class="VPDocFooter" data-v-172bb205 data-v-488b74bf><!--[--><!--]--><div class="edit-info" data-v-488b74bf><!----><div class="last-updated" data-v-488b74bf><p class="VPLastUpdated" data-v-488b74bf data-v-0cc7e936>更新时间: <time datetime="2024-01-04T09:17:01.000Z" data-v-0cc7e936></time></p></div></div><nav class="prev-next" data-v-488b74bf><div class="pager" data-v-488b74bf><!----></div><div class="pager" data-v-488b74bf><a class="VPLink link pager-link next" href="/2-%E7%BC%96%E7%A8%8B%E6%8A%80%E5%B7%A7/3-JavaScript/2-%E5%89%8D%E7%AB%AF%E5%A6%82%E4%BD%95%E5%86%99%E5%87%BA%E4%BC%98%E9%9B%85%E7%9A%84%E5%BC%82%E6%AD%A5%E5%A4%84%E7%90%86%E4%BB%A3%E7%A0%81.html" data-v-488b74bf><!--[--><span class="desc" data-v-488b74bf>下一页</span><span class="title" data-v-488b74bf>📄 前端如何写出优雅的异步处理代码</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><footer class="VPFooter has-sidebar" data-v-9c6d0652 data-v-74ec399e><div class="container" data-v-74ec399e><p class="message" data-v-74ec399e>何以解忧，唯有代码。不忘初心，方得始终。</p><p class="copyright" data-v-74ec399e>Copyright © 2019-present 陈随易</p></div></footer><!--[--><!--]--></div></div>
    <script>window.__VP_HASH_MAP__=JSON.parse("{\"1-前端世界_2-前端开发规范_1-基本简介.md\":\"pHfFcGBR\",\"2-编程技巧_3-javascript_2-前端如何写出优雅的异步处理代码.md\":\"SXJGzF1O\",\"4-编程小册_2-node.js指南_2-hello_world程序.md\":\"GsEKuSwj\",\"4-编程小册_2-node.js指南_4-认识npm.md\":\"D_WPX4M7\",\"6-易伴同行_2-自律记录_1-陈随易_1-2024年自律.md\":\"fMeY07Yg\",\"4-编程小册_2-node.js指南_3-简单的http应用.md\":\"6A-hfssN\",\"4-编程小册_2-node.js指南_7-模块系统.md\":\"BWdJDXtR\",\"4-编程小册_2-node.js指南_5-使用express包.md\":\"9H-5QWFP\",\"index.md\":\"QjQ0lBHl\",\"2-编程技巧_3-javascript_1-判断字符串第一个和最后一个字符.md\":\"mF-carb3\",\"2-编程技巧_4-nodejs_1-patch-package.md\":\"UweAMdpj\",\"4-编程小册_3-建站指南_1-基本简介.md\":\"hFyyjHCo\",\"4-编程小册_2-node.js指南_6-读取修改文件.md\":\"IQyZKXVC\",\"2-编程技巧_5-vscode_1-大小写转换插件.md\":\"kS7yd_fK\",\"6-易伴同行_1-关于社群_1-社群介绍.md\":\"WqgvBgep\",\"2-编程技巧_1-html_1-禁止浏览器填充账号密码.md\":\"4z6GZbkS\",\"3-案例教程_贪吃蛇_1-基本简介.md\":\"RA-U6WPr\",\"2-编程技巧_6-数据库_2-元数建模，数据库设计工具.md\":\"g-blKtTm\",\"2-编程技巧_6-数据库_1-浏览器es扩展插件.md\":\"kfeBTdsN\",\"2-编程技巧_4-nodejs_2-浏览器打印hiprint.md\":\"eWiUycFi\",\"6-易伴同行_2-自律记录_1-陈随易_0-个人介绍.md\":\"3aiRLHci\",\"4-编程小册_1-web前端_1-基本简介.md\":\"vDJJ6pEy\",\"4-编程小册_2-node.js指南_8-写一个dir命令.md\":\"Xhng7L2R\",\"5-软件手册_2-xyplorer_1-基本简介.md\":\"d7tONkhI\",\"2-编程技巧_4-nodejs_3-条形码和二维码扫码.md\":\"QvqqQDNs\",\"2-编程技巧_7-方法论_2-论编程学习.md\":\"bvjxrEbX\",\"1-前端世界_1-npm包推荐_1-基本简介.md\":\"NoI-Ij_C\",\"4-编程小册_2-node.js指南_1-node.js安装.md\":\"AGzy1qHv\",\"2-编程技巧_7-方法论_1-web前端进阶路线图.md\":\"AUJma3vJ\",\"2-编程技巧_8-其他_1-vuepress自动生成侧边菜单.md\":\"eCvXfzSM\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"陈随易\",\"titleTemplate\":false,\"description\":\"何以解忧，唯有代码。\",\"base\":\"/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"logo\":\"/logo.jpg\",\"lastUpdatedText\":\"更新时间\",\"siteTitle\":\"陈随易\",\"outline\":\"deep\",\"outlineTitle\":\"大纲\",\"socialLinks\":[{\"icon\":{\"svg\":\"<?xml version=\\\"1.0\\\" standalone=\\\"no\\\"?><!DOCTYPE svg PUBLIC \\\"-//W3C//DTD SVG 1.1//EN\\\" \\\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\\\"><svg t=\\\"1685703518937\\\" class=\\\"icon\\\" viewBox=\\\"0 0 1024 1024\\\" version=\\\"1.1\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\" p-id=\\\"2363\\\" xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" width=\\\"200\\\" height=\\\"200\\\"><path d=\\\"M512 1024C229.222 1024 0 794.778 0 512S229.222 0 512 0s512 229.222 512 512-229.222 512-512 512z m259.149-568.883h-290.74a25.293 25.293 0 0 0-25.292 25.293l-0.026 63.206c0 13.952 11.315 25.293 25.267 25.293h177.024c13.978 0 25.293 11.315 25.293 25.267v12.646a75.853 75.853 0 0 1-75.853 75.853h-240.23a25.293 25.293 0 0 1-25.267-25.293V417.203a75.853 75.853 0 0 1 75.827-75.853h353.946a25.293 25.293 0 0 0 25.267-25.292l0.077-63.207a25.293 25.293 0 0 0-25.268-25.293H417.152a189.62 189.62 0 0 0-189.62 189.645V771.15c0 13.977 11.316 25.293 25.294 25.293h372.94a170.65 170.65 0 0 0 170.65-170.65V480.384a25.293 25.293 0 0 0-25.293-25.267z\\\" fill=\\\"#C71D23\\\" p-id=\\\"2364\\\"></path></svg>\"},\"link\":\"https://gitee.com/yicode-team/yicode\"},{\"icon\":\"github\",\"link\":\"https://github.com/chenbimo/yicode\"}],\"footer\":{\"message\":\"何以解忧，唯有代码。不忘初心，方得始终。\",\"copyright\":\"Copyright © 2019-present 陈随易\"},\"docFooter\":{\"prev\":\"上一页\",\"next\":\"下一页\"},\"nav\":[{\"text\":\"前端世界\",\"items\":[{\"text\":\"npm包推荐\",\"link\":\"/1-前端世界/1-npm包推荐/1-基本简介\"},{\"text\":\"前端开发规范\",\"link\":\"/1-前端世界/2-前端开发规范/1-基本简介\"}]},{\"text\":\"编程技巧\",\"items\":[{\"text\":\"HTML\",\"link\":\"/2-编程技巧/1-HTML/1-禁止浏览器填充账号密码\"},{\"text\":\"JavaScript\",\"link\":\"/2-编程技巧/3-JavaScript/1-判断字符串第一个和最后一个字符\"},{\"text\":\"Nodejs\",\"link\":\"/2-编程技巧/4-Nodejs/1-patch-package\"},{\"text\":\"Vscode\",\"link\":\"/2-编程技巧/5-Vscode/1-大小写转换插件\"},{\"text\":\"数据库\",\"link\":\"/2-编程技巧/6-数据库/1-浏览器ES扩展插件\"},{\"text\":\"方法论\",\"link\":\"/2-编程技巧/7-方法论/1-WEB前端进阶路线图\"},{\"text\":\"其他\",\"link\":\"/2-编程技巧/8-其他/1-vuepress自动生成侧边菜单\"}]},{\"text\":\"案例教程\",\"items\":[{\"text\":\"贪吃蛇\",\"link\":\"/3-案例教程/贪吃蛇/1-基本简介\"}]},{\"text\":\"编程小册\",\"items\":[{\"text\":\"WEB前端\",\"link\":\"/4-编程小册/1-WEB前端/1-基本简介\"},{\"text\":\"Node.js指南\",\"link\":\"/4-编程小册/2-Node.js指南/1-Node.js安装\"},{\"text\":\"建站指南\",\"link\":\"/4-编程小册/3-建站指南/1-基本简介\"}]},{\"text\":\"软件手册\",\"items\":[{\"text\":\"xyplorer\",\"link\":\"/5-软件手册/2-xyplorer/1-基本简介\"}]},{\"text\":\"易伴同行\",\"items\":[{\"text\":\"关于社群\",\"link\":\"/6-易伴同行/1-关于社群/1-社群介绍\"},{\"text\":\"自律记录\",\"link\":\"/6-易伴同行/2-自律记录/1-陈随易/1-2024年自律\"}]}],\"sidebar\":{\"/1-前端世界/1-npm包推荐/\":[{\"id\":\"/1-前端世界/1-npm包推荐/\",\"pid\":\"\",\"text\":\"📁 npm包推荐\",\"collapsed\":false,\"items\":[{\"id\":\"1-基本简介.md\",\"pid\":\"/1-前端世界/1-npm包推荐/\",\"text\":\"📄 基本简介\",\"link\":\"/1-前端世界/1-npm包推荐/1-基本简介.md\"}]}],\"/1-前端世界/2-前端开发规范/\":[{\"id\":\"/1-前端世界/2-前端开发规范/\",\"pid\":\"\",\"text\":\"📁 前端开发规范\",\"collapsed\":false,\"items\":[{\"id\":\"1-基本简介.md\",\"pid\":\"/1-前端世界/2-前端开发规范/\",\"text\":\"📄 基本简介\",\"link\":\"/1-前端世界/2-前端开发规范/1-基本简介.md\"}]}],\"/2-编程技巧/1-HTML/\":[{\"id\":\"/2-编程技巧/1-HTML/\",\"pid\":\"\",\"text\":\"📁 HTML\",\"collapsed\":false,\"items\":[{\"id\":\"1-禁止浏览器填充账号密码.md\",\"pid\":\"/2-编程技巧/1-HTML/\",\"text\":\"📄 禁止浏览器填充账号密码\",\"link\":\"/2-编程技巧/1-HTML/1-禁止浏览器填充账号密码.md\"}]}],\"/2-编程技巧/3-JavaScript/\":[{\"id\":\"/2-编程技巧/3-JavaScript/\",\"pid\":\"\",\"text\":\"📁 JavaScript\",\"collapsed\":false,\"items\":[{\"id\":\"1-判断字符串第一个和最后一个字符.md\",\"pid\":\"/2-编程技巧/3-JavaScript/\",\"text\":\"📄 判断字符串第一个和最后一个字符\",\"link\":\"/2-编程技巧/3-JavaScript/1-判断字符串第一个和最后一个字符.md\"},{\"id\":\"2-前端如何写出优雅的异步处理代码.md\",\"pid\":\"/2-编程技巧/3-JavaScript/\",\"text\":\"📄 前端如何写出优雅的异步处理代码\",\"link\":\"/2-编程技巧/3-JavaScript/2-前端如何写出优雅的异步处理代码.md\"}]}],\"/2-编程技巧/4-Nodejs/\":[{\"id\":\"/2-编程技巧/4-Nodejs/\",\"pid\":\"\",\"text\":\"📁 Nodejs\",\"collapsed\":false,\"items\":[{\"id\":\"1-patch-package.md\",\"pid\":\"/2-编程技巧/4-Nodejs/\",\"text\":\"📄 patch-package\",\"link\":\"/2-编程技巧/4-Nodejs/1-patch-package.md\"},{\"id\":\"2-浏览器打印Hiprint.md\",\"pid\":\"/2-编程技巧/4-Nodejs/\",\"text\":\"📄 浏览器打印Hiprint\",\"link\":\"/2-编程技巧/4-Nodejs/2-浏览器打印Hiprint.md\"},{\"id\":\"3-条形码和二维码扫码.md\",\"pid\":\"/2-编程技巧/4-Nodejs/\",\"text\":\"📄 条形码和二维码扫码\",\"link\":\"/2-编程技巧/4-Nodejs/3-条形码和二维码扫码.md\"}]}],\"/2-编程技巧/5-Vscode/\":[{\"id\":\"/2-编程技巧/5-Vscode/\",\"pid\":\"\",\"text\":\"📁 Vscode\",\"collapsed\":false,\"items\":[{\"id\":\"1-大小写转换插件.md\",\"pid\":\"/2-编程技巧/5-Vscode/\",\"text\":\"📄 大小写转换插件\",\"link\":\"/2-编程技巧/5-Vscode/1-大小写转换插件.md\"}]}],\"/2-编程技巧/6-数据库/\":[{\"id\":\"/2-编程技巧/6-数据库/\",\"pid\":\"\",\"text\":\"📁 数据库\",\"collapsed\":false,\"items\":[{\"id\":\"1-浏览器ES扩展插件.md\",\"pid\":\"/2-编程技巧/6-数据库/\",\"text\":\"📄 浏览器ES扩展插件\",\"link\":\"/2-编程技巧/6-数据库/1-浏览器ES扩展插件.md\"},{\"id\":\"2-元数建模，数据库设计工具.md\",\"pid\":\"/2-编程技巧/6-数据库/\",\"text\":\"📄 元数建模，数据库设计工具\",\"link\":\"/2-编程技巧/6-数据库/2-元数建模，数据库设计工具.md\"}]}],\"/2-编程技巧/7-方法论/\":[{\"id\":\"/2-编程技巧/7-方法论/\",\"pid\":\"\",\"text\":\"📁 方法论\",\"collapsed\":false,\"items\":[{\"id\":\"1-WEB前端进阶路线图.md\",\"pid\":\"/2-编程技巧/7-方法论/\",\"text\":\"📄 WEB前端进阶路线图\",\"link\":\"/2-编程技巧/7-方法论/1-WEB前端进阶路线图.md\"},{\"id\":\"2-论编程学习.md\",\"pid\":\"/2-编程技巧/7-方法论/\",\"text\":\"📄 论编程学习\",\"link\":\"/2-编程技巧/7-方法论/2-论编程学习.md\"}]}],\"/2-编程技巧/8-其他/\":[{\"id\":\"/2-编程技巧/8-其他/\",\"pid\":\"\",\"text\":\"📁 其他\",\"collapsed\":false,\"items\":[{\"id\":\"1-vuepress自动生成侧边菜单.md\",\"pid\":\"/2-编程技巧/8-其他/\",\"text\":\"📄 vuepress自动生成侧边菜单\",\"link\":\"/2-编程技巧/8-其他/1-vuepress自动生成侧边菜单.md\"}]}],\"/3-案例教程/贪吃蛇/\":[{\"id\":\"/3-案例教程/贪吃蛇/\",\"pid\":\"\",\"text\":\"📁 贪吃蛇\",\"collapsed\":false,\"items\":[{\"id\":\"1-基本简介.md\",\"pid\":\"/3-案例教程/贪吃蛇/\",\"text\":\"📄 基本简介\",\"link\":\"/3-案例教程/贪吃蛇/1-基本简介.md\"}]}],\"/4-编程小册/1-WEB前端/\":[{\"id\":\"/4-编程小册/1-WEB前端/\",\"pid\":\"\",\"text\":\"📁 WEB前端\",\"collapsed\":false,\"items\":[{\"id\":\"1-基本简介.md\",\"pid\":\"/4-编程小册/1-WEB前端/\",\"text\":\"📄 基本简介\",\"link\":\"/4-编程小册/1-WEB前端/1-基本简介.md\"}]}],\"/4-编程小册/2-Node.js指南/\":[{\"id\":\"/4-编程小册/2-Node.js指南/\",\"pid\":\"\",\"text\":\"📁 Node.js指南\",\"collapsed\":false,\"items\":[{\"id\":\"1-Node.js安装.md\",\"pid\":\"/4-编程小册/2-Node.js指南/\",\"text\":\"📄 Node.js安装\",\"link\":\"/4-编程小册/2-Node.js指南/1-Node.js安装.md\"},{\"id\":\"2-Hello_world程序.md\",\"pid\":\"/4-编程小册/2-Node.js指南/\",\"text\":\"📄 Hello_world程序\",\"link\":\"/4-编程小册/2-Node.js指南/2-Hello_world程序.md\"},{\"id\":\"3-简单的http应用.md\",\"pid\":\"/4-编程小册/2-Node.js指南/\",\"text\":\"📄 简单的http应用\",\"link\":\"/4-编程小册/2-Node.js指南/3-简单的http应用.md\"},{\"id\":\"4-认识Npm.md\",\"pid\":\"/4-编程小册/2-Node.js指南/\",\"text\":\"📄 认识Npm\",\"link\":\"/4-编程小册/2-Node.js指南/4-认识Npm.md\"},{\"id\":\"5-使用express包.md\",\"pid\":\"/4-编程小册/2-Node.js指南/\",\"text\":\"📄 使用express包\",\"link\":\"/4-编程小册/2-Node.js指南/5-使用express包.md\"},{\"id\":\"6-读取修改文件.md\",\"pid\":\"/4-编程小册/2-Node.js指南/\",\"text\":\"📄 读取修改文件\",\"link\":\"/4-编程小册/2-Node.js指南/6-读取修改文件.md\"},{\"id\":\"7-模块系统.md\",\"pid\":\"/4-编程小册/2-Node.js指南/\",\"text\":\"📄 模块系统\",\"link\":\"/4-编程小册/2-Node.js指南/7-模块系统.md\"},{\"id\":\"8-写一个dir命令.md\",\"pid\":\"/4-编程小册/2-Node.js指南/\",\"text\":\"📄 写一个dir命令\",\"link\":\"/4-编程小册/2-Node.js指南/8-写一个dir命令.md\"}]}],\"/4-编程小册/3-建站指南/\":[{\"id\":\"/4-编程小册/3-建站指南/\",\"pid\":\"\",\"text\":\"📁 建站指南\",\"collapsed\":false,\"items\":[{\"id\":\"1-基本简介.md\",\"pid\":\"/4-编程小册/3-建站指南/\",\"text\":\"📄 基本简介\",\"link\":\"/4-编程小册/3-建站指南/1-基本简介.md\"}]}],\"/5-软件手册/2-xyplorer/\":[{\"id\":\"/5-软件手册/2-xyplorer/\",\"pid\":\"\",\"text\":\"📁 xyplorer\",\"collapsed\":false,\"items\":[{\"id\":\"1-基本简介.md\",\"pid\":\"/5-软件手册/2-xyplorer/\",\"text\":\"📄 基本简介\",\"link\":\"/5-软件手册/2-xyplorer/1-基本简介.md\"}]}],\"/6-易伴同行/1-关于社群/\":[{\"id\":\"/6-易伴同行/1-关于社群/\",\"pid\":\"\",\"text\":\"📁 关于社群\",\"collapsed\":false,\"items\":[{\"id\":\"1-社群介绍.md\",\"pid\":\"/6-易伴同行/1-关于社群/\",\"text\":\"📄 社群介绍\",\"link\":\"/6-易伴同行/1-关于社群/1-社群介绍.md\"}]}],\"/6-易伴同行/2-自律记录/\":[{\"id\":\"1-陈随易\",\"pid\":\"\",\"text\":\"📁 陈随易\",\"items\":[{\"id\":\"1-陈随易/0-个人介绍.md\",\"pid\":\"1-陈随易\",\"text\":\"📄 个人介绍\",\"link\":\"/6-易伴同行/2-自律记录/1-陈随易/0-个人介绍.md\"},{\"id\":\"1-陈随易/1-2024年自律.md\",\"pid\":\"1-陈随易\",\"text\":\"📄 2024年自律\",\"link\":\"/6-易伴同行/2-自律记录/1-陈随易/1-2024年自律.md\"}],\"collapsed\":true}]}},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":false}");</script>
    
  </body>
</html>